package org.gm.controller;

import lombok.AllArgsConstructor;
import org.gm.domain.dto.MinerDTO;
import org.gm.domain.vo.GethInfoVO;
import org.gm.service.GethService;
import org.springframework.web.bind.annotation.*;
import org.web3j.protocol.geth.Geth;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/geth")
@AllArgsConstructor
public class GethController {
    private GethService gethService;

    @GetMapping("/info")
    public List<GethInfoVO> info() throws IOException {
        return gethService.info();
    }

    @PostMapping("/open/miner")
    public void openMiner(@RequestBody MinerDTO minerDTO) throws IOException {
        gethService.openMiner(minerDTO);
    }

    @PostMapping("/close/miner")
    public void closeMiner(@RequestBody MinerDTO minerDTO) throws IOException {
        gethService.closeMiner(minerDTO);
    }
}
